package com.bw.ppjokeplay.commen.mvvm.model

import com.bw.ppjokeplay.commen.entity.BaseEntity
import com.bw.ppjokeplay.commen.network.ChangeObservable
import com.google.gson.Gson
import io.reactivex.Observable
import okhttp3.MediaType
import okhttp3.RequestBody

/**
 * @author Lishaohe
 * @description:
 * @date :2021/11/9 0009 下午 6:11
 *
 */
abstract class BaseModel : IModel{
    override fun createBody(map: HashMap<String, Any>): RequestBody {

        return RequestBody.create(MediaType.parse("application/json"),Gson().toJson(map))
    }

    override fun changeFun(observable: Observable<*>): Observable<BaseEntity> {

        return observable.map(ChangeObservable())
    }
}